<?php
include("utils.php");

 if($_SESSION['siteuserId']=="")
{
	header("location:start.php");
}


main_content("main();");
function main()
{
	 if($_SESSION['languageId']!="")
{
	$languageId=$_SESSION['languageId'];
}
else
{
	$languageId='1';
}

	$siteUserId=$_SESSION['siteuserId'];

	$selSiteurl=mysql_query("select * from adsite_master where siteuserId='".$siteUserId."'");
	
	if(isset($_POST['next']))
	{

$_SESSION['adspace_type'] = $_POST['adspace_type'];


	
		if($_POST['ad_Type']=='network')
		{
			$netVal='Y';
		}
		else
		{
			$netVal='N';
		}

$_SESSION['netVal'] = $netVal;

	$insertAdMaster="insert into adspace_master set adsiteId='".$_POST['site_id']."', UserId='".$siteUserId."', langId='".$languageId."', ad_Type = '".$_REQUEST['ad_Type']."'";
	//echo $insertAdMaster;
	$exeAdmaster = mysql_query($insertAdMaster);
	$adspaceId = mysql_insert_id();	
	$md_no=md5($adspaceId);
$updateAdMaster=mysql_query("update adspace_master set adspaceIdMd='".$md_no."' where adspaceId='".$adspaceId."' ");
	$insertAd = "insert into adspace_details set adspaceId='".$adspaceId."', adspaceIdMd='".$md_no."',  adspaceType='".$_POST['adspace_type']."',adSize='".$_POST['size']."',fontType='".$_POST['font_type']."',backgroundColor='".$_POST['background_color']."',noOfTextAd='".$_POST['cell_count']."',headerColor='".$_POST['title_color']."',thumbOrientation='".$_POST['alignment']."',bodyColor='".$_POST['description_color']."', allowNetwork='".$netVal."' ";
	//echo $insertAd;
	$exeinsertAd = mysql_query($insertAd);
	$_SESSION['adspaceId']=$adspaceId;

//header("location:sell_space_add_details.php");
echo '<script>window.location="sell_space_add_details.php?tab=sell_ads&subMenu=2";</script>';
	
	}

?>
<!--<link rel="shortcut icon" href="https://www.etology.com/themes/etology/images/favicon.ico">-->
   <link rel="stylesheet" href="css/adspace.css" type="text/css">
  <link rel="stylesheet" href="css/style_002.css" type="text/css">
  <script type="text/javascript" language="javascript" src="JavaScripts/common.js"></script>
  <script type="text/javascript" language="javascript" src="JavaScripts/popup-layer.js"></script>
  <script type="text/javascript" language="javascript" src="JavaScripts/category-list.js"></script>
  <script type="text/javascript" language="javascript" src="JavaScripts/cover.js"></script>
<div id="colorlayer" onMouseOver="javascript:enterColorPalette()" onMouseOut="javascript:leaveColorPalette()" class="drag" style="visibility: hidden; width: 204px; height: 142px; position: absolute; z-index: 4; left: 488px; top: 635px;">
  <table bgcolor="#ffffff" border="0" cellpadding="1" cellspacing="2" width="100%">
    <tbody>
    <tr>
        <td id="selectedcolor" bgcolor="#ff8080" width="12%"></td>
        <td id="colorcode" align="center" width="75%"><b>#FF8080</b></td>
        <td width="12%">
          <div id="transparent" style="cursor: pointer; visibility: hidden;">
            <img src="images/transparent.gif" onMouseOver="javascript:onTransparent();" onClick="javascript:onClickTransparent();preview();">
          </div>
        </td>
    </tr>
    </tbody>
  </table>
  <table id="colortable" style="border: 1px solid rgb(127, 157, 185); cursor: pointer; height: 115px;" bgcolor="#ffffff" border="0" cellpadding="1" cellspacing="2" width="100%">
    <tbody>
    <!--<tr><td bgcolor="#ff8080" height="17"></td><td bgcolor="#ffff80" height="17"></td><td bgcolor="#80ff80" height="17"></td><td bgcolor="#00ff80" height="17"></td><td bgcolor="#80ffff" height="17"></td><td bgcolor="#0080ff" height="17"></td><td bgcolor="#ff80c0" height="17"></td><td bgcolor="#ff80ff" height="17"></td></tr><tr><td bgcolor="#ff0000" height="17"></td><td bgcolor="#ffff00" height="17"></td><td bgcolor="#80ff00" height="17"></td><td bgcolor="#00ff40" height="17"></td><td bgcolor="#00ffff" height="17"></td><td bgcolor="#0080c0" height="17"></td><td bgcolor="#8080c0" height="17"></td><td bgcolor="#ff00ff" height="17"></td></tr><tr><td bgcolor="#804040" height="17"></td><td bgcolor="#ff8040" height="17"></td><td bgcolor="#00ff00" height="17"></td><td bgcolor="#008080" height="17"></td><td bgcolor="#004080" height="17"></td><td bgcolor="#8080ff" height="17"></td><td bgcolor="#800040" height="17"></td><td bgcolor="#ff0080" height="17"></td></tr><tr><td bgcolor="#800000" height="17"></td><td bgcolor="#ff8000" height="17"></td><td bgcolor="#008000" height="17"></td><td bgcolor="#008040" height="17"></td><td bgcolor="#0000ff" height="17"></td><td bgcolor="#0000a0" height="17"></td><td bgcolor="#800080" height="17"></td><td bgcolor="#8000ff" height="17"></td></tr><tr><td bgcolor="#400000" height="17"></td><td bgcolor="#804000" height="17"></td><td bgcolor="#004000" height="17"></td><td bgcolor="#004040" height="17"></td><td bgcolor="#000080" height="17"></td><td bgcolor="#000040" height="17"></td><td bgcolor="#400040" height="17"></td><td bgcolor="#400080" height="17"></td></tr><tr><td bgcolor="#000000" height="17"></td><td bgcolor="#808000" height="17"></td><td bgcolor="#808040" height="17"></td><td bgcolor="#808080" height="17"></td><td bgcolor="#408080" height="17"></td><td bgcolor="#c0c0c0" height="17"></td><td bgcolor="#400040" height="17"></td><td bgcolor="#ffffff" height="17"></td></tr>--></tbody>
  </table>
  <iframe src="selling-basic-adspace-add_files/blank_003.html" style="position: absolute; visibility: inherit; top: 0px; left: 0px; width: 204px; height: 142px; z-index: -1;" frameborder="0">
  </iframe>
</div>

<script language="javascript" type="text/javascript">
<!--
    var transparent = "TRANSPARENT";

    var ns = document.getElementById&&!document.all; //boolean flag for netscape/firefox
    var objId; //object id
    var selected; //selected color
    var onchangeFlag = false;
    init();

    //Initialize the color table.
    function init() {
        var colors = new Array (
            ['#FF8080', '#FFFF80', '#80FF80', '#00FF80', '#80FFFF', '#0080FF', '#FF80C0', '#FF80FF'],
            ['#FF0000', '#FFFF00', '#80FF00', '#00FF40', '#00FFFF', '#0080C0', '#8080C0', '#FF00FF'],
            ['#804040', '#FF8040', '#00FF00', '#008080', '#004080', '#8080FF', '#800040', '#FF0080'],
            ['#800000', '#FF8000', '#008000', '#008040', '#0000FF', '#0000A0', '#800080', '#8000FF'],
            ['#400000', '#804000', '#004000', '#004040', '#000080', '#000040', '#400040', '#400080'],
            ['#000000', '#808000', '#808040', '#808080', '#408080', '#C0C0C0', '#400040', '#FFFFFF']
        );
        var table = document.getElementById("colortable");

        for (itr in colors) {
            var row = table.insertRow(-1);
            for (itd in colors[itr]) {
                var cell = row.insertCell(-1);
                cell.height = 17;
                cell.innerText = "";
                cell.bgColor = colors[itr][itd];

                //when move mouse to a cell, the selected color will changed
                cell.onmouseover = function() {
                    var colorcode = document.getElementById("colorcode");
                    colorcode.innerHTML = "<b>" + this.bgColor.toUpperCase() + "</b>";
                    var selectedcolor = document.getElementById("selectedcolor");
                    selectedcolor.bgColor = this.bgColor;
                    selected = selectedcolor;
                }
                //when mouse click, the selected color will be assigned to obj
                //and color palette will be closed
                cell.onclick  = function(){
                    if (objId != '') {
                        var obj = document.getElementById(objId);
                    }
                    obj.value = selected.bgColor.toUpperCase();
                    if (obj.onchange) {
                        obj.onchange();
                    }                    
                    onClickPalette('', null);
                    preview();
                };
            }
        }
    }


    //It is called when mouse over transparent cell
    function onTransparent() {
        var colorcode = document.getElementById("colorcode");
        colorcode.innerHTML = "<b>" + transparent + "</b>";
        var selectedcolor = document.getElementById("selectedcolor");
        selectedcolor.bgColor = "Transparent";
    }


    //It is called when mouseclick on transparent cell
    function onClickTransparent() {
        if (objId != '') {
            var obj = document.getElementById(objId);
        }
        obj.value = 'TRANSPARENT';
        onClickPalette('', null);
    }

    //show or hide the palette
    //it also inits table data and div position
    function onClickPalette(objid, control, isTran, leftTopDisplay) {
        if (!document.all && onchangeFlag) {
            return;
        }
        var l = 0;
        var t = 0;
        var obj;
        if (objid != '') {
            obj = document.getElementById(objid);
            objId = objid;
        }

        //check that needs the transparent or not
        var transparent = document.getElementById("transparent");
        if (typeof(isTran) != "undefined") {
            transparent.style.visibility = (isTran) ? "inherit" : "hidden";
        }
        else {
            transparent.style.visibility = "hidden";
        }

        //calculate the control position
        if (control != null) {
            controlTop = control.offsetTop;
            controlLeft = control.offsetLeft + 20;
            while(control = control.offsetParent) {
                controlTop += control.offsetTop;
                controlLeft += control.offsetLeft;
            }
        }

        //init div position
        var div = document.getElementById('colorlayer');
        if (leftTopDisplay != null) {
            leftDistance = controlLeft - div.offsetWidth;
            topDistance = controlTop - div.offsetHeight;
            div.style.left = leftDistance + "px";
            div.style.top = topDistance + "px";
        }
        else {
            div.style.left = controlLeft + "px";
            div.style.top = controlTop + "px";
        }

        //init div data
        if (div.style.visibility == 'hidden') {
            var selectedcolor = document.getElementById('selectedcolor');
            selectedcolor.bgColor = obj.value;
            var colorcode = document.getElementById('colorcode');
            colorcode.innerHTML = "<b>" + obj.value.toUpperCase() + "</b>";
        }

        div.style.visibility = (div.style.visibility == 'hidden') ? 'visible' : 'hidden';
    }

    var inColorPalette = false;
    function mousedown() {
        if (!inColorPalette) {
            var div = document.getElementById('colorlayer');
            div.style.visibility = 'hidden';
        }
    }

    function leaveColorPalette() {
        inColorPalette=false;
    }

    function enterColorPalette() {
        inColorPalette=true;
    }

    document.onmousedown = mousedown;

-->
</script>
<script language="javascript" type="text/javascript">
// <!--
//     var adspaceOnload = window.onload; 
//     window.onload = function() {
//         if (adspaceOnload) {
//             adspaceOnload();
//         }
//         //document.getElementById("adspaceType").value = 'selling-basic-adspace-add.php?sid=f02b43b24afb4d07943eb63ecfc53e9e';
//         changeRating();
//     }
// -->
</script>
	
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
	<tr>
	<td valign="top"><table border="0" align="center" cellpadding="0" cellspacing="0" class="admob-Height">
	<tr>
		<td width="244" valign="top"><?php include("left_pannel.php"); ?></td>
		<td width="14" valign="top">&nbsp;</td>
		<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
		<tr>
		<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td width="14"><img src="images/admob-BoxTopLeftCor.jpg" alt="" width="14" height="14" /></td>
			<td class="admob-BoxTopBg"><img src="images/spacer.gif" alt="" width="10" height="10" /></td>
			<td width="14"><img src="images/admob-BoxTopRightCor.jpg" alt="" width="14" height="14" /></td>
			</tr>
		</table></td>
		</tr>
		<tr>
		<td valign="top" class="admob-BoxMiddleBg"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-Height">
			<tr>
			<td width="450" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td class="admob-SquareBoxTilteBg">Ad Space Characteristics</td>
			</tr>
			<tr>
			<td class="admob-SquareBoxBorder"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="admob-FormContent">
				<tr>
				<td width="150" height="25"><strong>Ad Space Type:</strong></td>
				<td><select name="select" class="admob-CustomizeSmallDropDown">
				</select>
				</td>
				</tr>
				<tr>
				<td height="25">Choose a Web Site:</td>
				<td><select name="select2" class="admob-CustomizeLargeDropDown">
				</select></td>
				</tr>
				<tr>
				<td height="25">#Ads:</td>
				<td><select name="select3" class="admob-CustomizeDropDown">
				</select></td>
				</tr>
				<tr>
				<td height="25">#Ads Type:</td>
				<td><select name="select4" class="admob-CustomizeDropDownBig">
				</select></td>
				</tr>
				<tr>
				<td height="40">View:</td>
				<td><input name="radiobutton" type="radio" value="radiobutton" />
				Horizontal<br />
								<input name="radiobutton" type="radio" value="radiobutton" />
								<label for="vertical">Vertical</label></td>
				</tr>
				<tr>
				<td height="25">Standard Size:</td>
				<td><select name="select5" class="admob-CustomizeLargeDropDown">
				</select></td>
				</tr>
				<tr>
				<td height="25">Font Type:</td>
				<td><select name="select6" class="admob-CustomizeDropDownBig">
				</select></td>
				</tr>
				<tr>
				<td height="25">Background Color:</td>
				<td><input type="text" name="textfield3" class="admob-CustomizeInputBox" /></td>
				</tr>
				<tr>
				<td height="25">Headline Color:</td>
				<td><input type="text" name="textfield32" class="admob-CustomizeInputBox" /></td>
				</tr>
				<tr>
				<td height="25">Description Color:</td>
				<td><input type="text" name="textfield33" class="admob-CustomizeInputBox" /></td>
				</tr>
				<tr>
				<td height="35" valign="top">Hide Broker Link:</td>
				<td><select name="select7" class="admob-CustomizeDropDown">
				</select>
				<br />
				<a href="#" class="admob-RightLink">restore defaults</a></td>
				</tr>
				<tr>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				</tr>
				<tr>
				<td height="25">&nbsp;</td>
				<td><table border="0" align="left" cellpadding="0" cellspacing="0">
				<tr>
				<td><input name="Submit22" type="submit" class="admob-InputButton" value="&lt; Back" /></td>
				<td width="10">&nbsp;</td>
				<td><input name="Submit23" type="submit" class="admob-InputButton" value="Next &gt;" /></td>
				</tr>
				</table></td>
				</tr>
			</table></td>
			</tr>
			</table></td>
			<td width="13" valign="top">&nbsp;</td>
			<td width="450" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td class="admob-SquareBoxTilteBg">Ad Space Characteristics</td>
			</tr>
			<tr>
			<td class="admob-SquareBoxBorder"><table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
				<td class="admob-FormContent">&nbsp;</td>
				</tr>
				<tr>
				<td class="admob-FormContent"><a href="#" class="admob-RightLink">Advertise Here</a></td>
				</tr>
			</table></td>
			</tr>
			</table></td>
			</tr>
		</table></td>
		</tr>
		<tr>
		<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td width="14"><img src="images/admob-BoxBottomLeftCor.jpg" alt="" width="14" height="14" /></td>
			<td class="admob-BoxBottomBg"><img src="images/spacer.gif" alt="" width="10" height="10" /></td>
			<td width="14"><img src="images/admob-BoxBottomRightCor.jpg" alt="" width="14" height="14" /></td>
			</tr>
		</table></td>
		</tr>
		</table></td>
	</tr>
	</table></td>
	</tr>
	</table>
